package upgrade

import (
	"appengine"
	"appengine/datastore"
)

type App struct {
	Key  	string
	Value   string
}

func getAppValue(ctx appengine.Context , key string) (string, error){
	var k = datastore.NewKey(ctx, "App", key, 0, nil)
	app := new(App)
	if err := datastore.Get(ctx, k, app); err != nil {
		return "", err
	}
	return app.Value, nil
}

func setAppValue(ctx appengine.Context , key string, value string) error {
	var k = datastore.NewKey(ctx, "App", key, 0, nil)
	app := &App{key, value}
	if _, err := datastore.Put(ctx, k, app); err != nil {
		return err
	}
	return nil
}
